public class Solution343 {
    public int integerBreak(int n) {
        if (n==2||n==3){
            return n-1;
        }
        int[] f=new int[n+1];
        f[1]=1;
        f[2]=2;
        f[3]=3;
        for (int i=4;i<=n;i++){
            for (int j=2;j<=i-2;j++){
                f[i]=Math.max(f[i],f[j]*(i-j));
            }
        }
        return f[n];
    }

    public static void main(String[] args) {
        System.out.println(new Solution343().integerBreak(10));
    }
}
